#include <stdio.h>
#define M 100
#define N 100
void ReadMatrix(int a[][M],int n,int m)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            printf("please input No.%d line No.%d row number:",i+1,j+1);
            scanf("%d",&a[i][j]);
        }
    }
}
void PrintMatrix(int a[][M],int n,int m)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            printf("%-4d",a[i][j]);
        }
        putchar('\n');
    }
    putchar('\n');
}
void AddMatrix(int a[][M],int b[][M],int c[][M],int n,int m)
{
    int i,j;
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            c[i][j]=a[i][j]+b[i][j];
        }
    }
}
void main()
{
    int m,n;
    int a[N][M],b[N][M];
    printf("please input line number:");
    scanf("%d",&n);
    printf("please input row number:");
    scanf("%d",&m);
    printf("please input the a matrix:\n");
    ReadMatrix(a,n,m);
    printf("please input the b matrix:\n");
    ReadMatrix(b,n,m);
    printf("the a matrix is:\n");
    PrintMatrix(a,n,m);
    printf("the b matrix is:\n");
    PrintMatrix(b,n,m);
    int c[N][M];
    AddMatrix(a,b,c,n,m);
    printf("the combination matrix is:\n");
    PrintMatrix(c,n,m);
}
